<!-- 我的收藏 -->
<template>
  <div class="my-store-page">
    <el-row class="table">
      <el-row class="table-item" v-for="(item,index) in listData" :key="index">
        <el-row type="flex" justify="space-between">
          <el-row type="flex" align="middle">
            <div class="title">{{item.propertyName}}</div>
            <el-tag effect="plain" size="mini">{{propertyType[item.type]}}</el-tag>
          </el-row>
          <div
            class="btn"
            :class="item.state==6?'btn1':'btn2'"
            @click="herfto('propsTrade/tradeinfo',item)"
          >{{propsState[item.state]}}</div>
        </el-row>
        <el-row type="flex" justify="space-between">
          <el-row type="flex">
            <div>项目编号：{{item.propertyNo}}</div>
            <div class="price">挂牌价格：{{item.listingPrice}}</div>
            <div>挂牌截止时间：{{item.enrollEndTime}}</div>
            <div class="remain-time">
              距结束：
              <countDown
                :endTime="item.enrollEndTime"
                :propertyNo="item.propertyNo"
                :index="index"
                @timeEnd="timeEnd"
              />
            </div>
          </el-row>
          <div>项目状态：{{propsState[item.state]}}</div>
        </el-row>
      </el-row>
    </el-row>
  </div>
</template>

<script>
import countDown from '../../components/common/CountDown'
import {propsState,propsType} from '@/utils/setting'
export default {
  props: ['listData'],
  components: {
    countDown
  },
  data() {
    return {
      searchVal: '',
      propertyType:propsType,
      propsState
    }
  },
  computed: {},
  watch: {},
  methods: {
    timeEnd(propertyNo, index) {
      // 倒计时结束改变项目状态
      // console.log('活动已结束:', propertyNo, index)
      if (this.listData[index].propertyNo == propertyNo) {
        this.listData[index].state = 8
      }
    },
    herfto(name, item) {
      if (item.state == 6) {
        this.$router.push({
          path: `/${name}`,
          query: {id:item.id}
        })
      }
    }
  },
  created() {},
  mounted() {}
}
</script>

<style lang='less' scoped>
.btn2 {
  background: #ccc;
}
.btn1 {
  background: #fbab0b;
}

.table {
  margin-top: 32px;

  &-item {
    padding: 20px 0;
    font-size: 12px;
    color: #656565;
    line-height: 12px;
    border-bottom: 1px solid #ebebeb;
    > .el-row:first-child {
      padding-bottom: 13px;
      .title {
        font-size: 14px;
        color: #333333;
        line-height: 14px;
      }
      .el-tag {
        margin: 0 16px;
      }

      .btn {
        width: 90px;
        height: 28px;

        border-radius: 4px;
        text-align: center;
        line-height: 28px;
        font-size: 14px;
        color: #ffffff;
      }
    }
    .price {
      padding: 0 54px;
    }
    .remain-time {
      font-size: 12px;
      color: #c5151d;
      line-height: 12px;
      padding-left: 54px;
    }
  }
}
.search {
  .el-button {
    margin-left: 20px;
  }
}
</style>